package com.cjc.card.greeting.task;

import com.cjc.card.greeting.service.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import java.time.LocalDateTime;

@Configuration
@EnableScheduling
public class MyTask {

    @Autowired
    private TaskService taskService;

    @Scheduled(cron = "0/5 * * * * ?")
    private void configureTasks(){

        taskService.task();

        System.out.println("执行任务 " + LocalDateTime.now());

    }

}
